package net.googlecode.morenko.task5.calculators;

import net.googlecode.morenko.task5.workers.Worker;

/**
 * The calculator factory class.
 */
public class CalculatorFactory {
    /**
     * Select the right calculator for person.
     * @param person
     * @return calculator object reference, null if nothing.
     */
    public static Calculator getCalculator(Worker person) {
        switch (person.getPost()) {
            case MANAGER:
                return new ManagerCalculator();
            case EMPLOYEE:
                return new EmployeeCalculator();
            case DIRECTOR:
                return new DirectorCalculator();
            default:
                return null;
        }
    }
}
